@echo off
echo.
echo =========================================================
echo   CreatePackage
echo      Creates a new MSI package
echo =========================================================
echo.

@call BuildLibrary.bat /q Release
@if errorlevel 1 goto :error

@call RunTests.bat Release
@if errorlevel 1 goto :error

@call CopyAssemblies.bat /q Release
@if errorlevel 1 goto :error

@call BuildInstallation.bat /q Release
@if errorlevel 1 goto :error

@goto :exit

@REM  -------------------------------------------
@REM  Handle errors
@REM
@REM  Use the following after any call to exit
@REM  and return an error code when errors occur
@REM
@REM  if errorlevel 1 goto :error	
@REM  -------------------------------------------
:error
if %returnErrorCode%==false goto exit

@ECHO An error occured in CreatePackage.bat - %errorLevel%
if %pause%==true PAUSE
@exit errorLevel

echo.
echo =========================================================
echo Finished building MSI package
echo =========================================================
echo.

@REM  ----------------------------------------
@REM  The exit label
@REM  ----------------------------------------
:exit
if %pause%==true PAUSE

popd
set pause=
set solutionDir=
set buildType=
set returnErrorCode=
set prompt=%savedPrompt%
set savedPrompt=
